// 个人失败分析排行
define('sonFalseSelfController', ['angular','echarts'], function (angular,echarts) {
    var module = angular.module('controllers');
    module.controller('sonFalseSelfController', ['$scope','failureReasonServers',function ($scope,failureReasonServers) {
        var myChart = echarts.init(document.getElementById('main'));
    	var	option = {
			title : {
			  text: 'xxx实习公司 2016年10月公司失败分析',
			  x:'center'
			},
			tooltip : {
			  trigger: 'item',
			  formatter: "{a} <br/>{b} : {c} ({d}%)"
			},
			legend: {
			  orient: 'horizontal',
			  bottom: '10',
			  data: []
			},
			series : [
			  {
			      name: '失败原因',
			      type: 'pie',
			      radius : '55%',
			      center: ['50%', '40%'],
			      data:[
			          {value:335, name:'只找暑假、寒假工'},
			          {value:310, name:'应聘岗位已具备1年以上工作经验'},
			          {value:234, name:'嫌实习收入太低'},
			          {value:135, name:'知悉我们的模式并且反感'},
			          {value:1548, name:'没有投过简历，个人没兴趣'},
			          {value:135, name:'广告信息'},
			          {value:135, name:'初中或者小学学历'},
			          {value:135, name:'已参加过同类培训'},
			          {value:135, name:'年龄过小或过大'},
			          {value:135, name:'想找工作不想实习'},
			          {value:135, name:'想从事其它职位(跟进记录请写哪个职位)'},
			          {value:135, name:'负面信息'},
			          {value:135, name:'已找到工作(跟进记录请写哪个职位)'},
			          {value:135, name:'持续3天每半天1次，固话手机均联系不上'},
			          {value:135, name:'家人或亲友反对'},
			          {value:135, name:'其它理由（跟进记录请写具体理由）'}
			      ],
			      itemStyle: {
			          	emphasis: {
							shadowBlur: 10,
							shadowOffsetX: 0,
							shadowColor: 'rgba(0, 0, 0, 0.5)'
			          	}
			      }
			  }
			]
		};
		failureReasonServers.getFailureReason().then(function(data){
			var arrData=[];
			for(var v in data){
				arrData.push(data[v].failure_reason);
			}
			option.legend.data=arrData;
	    	// 使用刚指定的配置项和数据显示图表。
	    	myChart.setOption(option);
		});
    }]);
});